package com.cpe.web.intercepter.factory;

import java.util.List;

import org.springframework.web.servlet.HandlerInterceptor;

import com.google.common.collect.Lists;
import com.cpe.web.config.InterceptorConfig;

/**
 * 全局拦截器工厂（前置+后置）
 * 
 * @description TODO
 * @author zhoud
 * @date 2015年11月10日 下午5:17:18
 */
public class GlobalInterceptorFactory {
	private static GlobalInterceptorFactory instance = new GlobalInterceptorFactory();

	public static GlobalInterceptorFactory instance() {
		return instance;
	}

	private List<HandlerInterceptor> preInterceptors;

	private List<HandlerInterceptor> postInterceptors;

	private GlobalInterceptorFactory() {
		preInterceptors = Lists.newLinkedList();
		postInterceptors = Lists.newLinkedList();
		InterceptorConfig.instance().load(preInterceptors, postInterceptors);
	}

	public List<HandlerInterceptor> getPreInterceptors() {
		return preInterceptors;
	}

	public List<HandlerInterceptor> getPostInterceptors() {
		return postInterceptors;
	}
}
